package com.dinzeer.lostbladereborn.data;

import com.dinzeer.lostbladereborn.Lostbladereborn;
import com.dinzeer.lostbladereborn.regsitry.LBRCreativeTab;
import com.dinzeer.lostbladereborn.regsitry.LBRSlashArtRegsitry;
import com.dinzeer.lostbladereborn.regsitry.LBRSpecialEffectRegsitry;
import mods.flammpfeil.slashblade.item.SwordType;
import mods.flammpfeil.slashblade.registry.slashblade.EnchantmentDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.PropertiesDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.RenderDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.SlashBladeDefinition;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.List;

public class LBRBuiltinRegsitry {
    //现世刀「斩月」
    public static final ResourceKey<SlashBladeDefinition> zangetsu=register("zangetsu");;
    //铭刀「蟾宫」
    public static final ResourceKey<SlashBladeDefinition> frog=register("frog");;
    //铭刀「鱼音」
    public static final ResourceKey<SlashBladeDefinition> fish=register("fish");
    //天锁斩月
    public static final ResourceKey<SlashBladeDefinition> tensazangetsu=register("tensazangetsu");
    //物理学圣剑
    public static final ResourceKey<SlashBladeDefinition> crowbar=register("crowbar");
    //§4§o铭刀「悭臾」
    public static final ResourceKey<SlashBladeDefinition> undragon=register("undragon");
    //星璇「天枢」
    public static final ResourceKey<SlashBladeDefinition> Dubhe=register("dubhe");
    //星璇「天权」
    public static final ResourceKey<SlashBladeDefinition> Megrez=register("megrez");
    //星璇「开阳」
    public static final ResourceKey<SlashBladeDefinition> Mizar=register("mizar");
    //星璇「天玑」
    public static final ResourceKey<SlashBladeDefinition> Phecda=register("phecda");
    //星璇「天玄」
    public static final ResourceKey<SlashBladeDefinition> Hagen=register("hagen");
    //星璇「瑶光」
    public static final ResourceKey<SlashBladeDefinition> Alkaid=register("alkaid");
    //星璇「玉衡」
    public static final ResourceKey<SlashBladeDefinition> Fenrir=register("fenrir");
    //星璇「空白」
    public static final ResourceKey<SlashBladeDefinition> White=register("white");
    //管理员之刃「伪物」
    public static final ResourceKey<SlashBladeDefinition> administrator=register("administrator");;
    public static void registerAll(BootstapContext<SlashBladeDefinition> bootstrap) {






        bootstrap.register(
                zangetsu, new SlashBladeDefinition(Lostbladereborn.prefix("zangetsu"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/zangetsu/zangetsu.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/zangetsu/zangetsu.obj"))
                                .effectColor(16766464)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.MoonDrive.getId())
                                .baseAttackModifier(20)
                                .maxDamage(2000)
                                .build(),
                        List.of(  new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.THORNS), 3)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                frog, new SlashBladeDefinition(Lostbladereborn.prefix("frog"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/frog/frog.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/frog/frog.obj"))
                                .effectColor(16766464)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.FrogGlaxy.getId())
                                .baseAttackModifier(15)
                                .maxDamage(2000)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BLOCK_FORTUNE), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SMITE), 5)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                fish, new SlashBladeDefinition(Lostbladereborn.prefix("fish"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/fish/fish.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/fish/fish.obj"))
                                .effectColor(54527)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.SaveAll.getId())
                                .baseAttackModifier(17)
                                .maxDamage(2000)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.ALL_DAMAGE_PROTECTION), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_PROTECTION), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SWEEPING_EDGE), 2),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FALL_PROTECTION), 2)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                tensazangetsu, new SlashBladeDefinition(Lostbladereborn.prefix("tensazangetsu"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/tensazangetsu/texture.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/tensazangetsu/model.obj"))
                                .effectColor(0)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.MoonDriveEX.getId())
                                .baseAttackModifier(30)
                                .maxDamage(2000)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BLOCK_FORTUNE), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 10),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SMITE), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.MENDING), 1)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));

        bootstrap.register(
                crowbar, new SlashBladeDefinition(Lostbladereborn.prefix("crowbar"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/crowbar/crowbar.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/crowbar/crowbar.obj"))
                                .effectColor(16711680)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.Elbowstrike.getId())
                                .baseAttackModifier(12)
                                .maxDamage(2000)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 7),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.KNOCKBACK), 7),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.ALL_DAMAGE_PROTECTION), 5)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                undragon, new SlashBladeDefinition(Lostbladereborn.prefix("undragon"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/undragon/undragon.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/undragon/undragon.obj"))
                                .effectColor(16711680)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.DragonBreak.getId())

                                .baseAttackModifier(32)
                                .maxDamage(2000)
                                .build(),
                        List.of(  new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 10),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BANE_OF_ARTHROPODS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Dubhe, new SlashBladeDefinition(Lostbladereborn.prefix("dubhe"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/dubhe.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(16711680)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())

                                .addSpecialEffect(LBRSpecialEffectRegsitry.Dubhe.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.DubheEX.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Megrez, new SlashBladeDefinition(Lostbladereborn.prefix("megrez"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/megrez.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(65379)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())

                                .addSpecialEffect(LBRSpecialEffectRegsitry.Megrez.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.MegrezEX.getId())
                                .baseAttackModifier(15)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Mizar, new SlashBladeDefinition(Lostbladereborn.prefix("mizar"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/mizar.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(917759)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(LBRSpecialEffectRegsitry.Mizar.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.MizarEX.getId())
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Phecda, new SlashBladeDefinition(Lostbladereborn.prefix("phecda"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/phecda.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(15662848)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.Phecda.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.PhecdaEX.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Hagen, new SlashBladeDefinition(Lostbladereborn.prefix("hagen"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/hagen.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(16764160)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(LBRSpecialEffectRegsitry.Hagen.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.HagenEX.getId())
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Alkaid, new SlashBladeDefinition(Lostbladereborn.prefix("alkaid"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/alkaid.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(11993343)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.Alkaid.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.AlkaidEX.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                Fenrir, new SlashBladeDefinition(Lostbladereborn.prefix("fenrir"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/fenrir.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(65535)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.Fenrir.getId())
                                .addSpecialEffect(LBRSpecialEffectRegsitry.FenrirEX.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 9)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                White, new SlashBladeDefinition(Lostbladereborn.prefix("white"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/stars/white.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/stars/xingxuan.obj"))
                                .effectColor(16777215)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(LBRSlashArtRegsitry.StarSlash.getId())
                                .baseAttackModifier(10)
                                .maxDamage(2000)
                                .build(),
                        List.of(

                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 3)
                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                administrator, new SlashBladeDefinition(Lostbladereborn.prefix("administrator"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Lostbladereborn.prefix("model/lostblade/administrator/administrator.png"))
                                .modelName(Lostbladereborn.prefix("model/lostblade/administrator/administrator.obj"))
                                .effectColor(14591)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .baseAttackModifier(13)
                                .slashArtsType(LBRSlashArtRegsitry.delete.getId())
                                .maxDamage(2000)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 10)

                        ),
                        LBRCreativeTab.Slashblade.getId()
                ));
    }
    private static ResourceKey<SlashBladeDefinition> register(String id) {
        return ResourceKey.create(SlashBladeDefinition.REGISTRY_KEY, Lostbladereborn.prefix(id));
    }
    static ResourceLocation getEnchantmentID(Enchantment enchantment) {
        return ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
    }
}
